using System;
using EPiServer.Common;
using EPiServer.Common.Rating;
using EPiServer.Common.Security;
using EPiServer.Community.Contact;
using EPiServer.Community.Contact.Queries;

namespace EPiAbstractions.Community.Contact
{
    public interface IContactHandlerFacade
    {
        ContactContainer AddContactContainer(ContactContainer contactContainer);

        ContactContainer GetContactContainer(IUser owner);

        ContactContainer GetContactContainer(IUser owner, ISite site);

        ContactContainer GetContactContainer(IUser owner, ISite site, Boolean createContainer);

        ContactContainer GetContactContainer(Int32 id);

        ContactContainerCollection GetContactContainers(IUser owner);

        ContactRelation AddContactRelation(ContactRelation contactRelation);

        void UpdateContactRelation(ContactRelation contactRelation);

        void RemoveContactRelation(ContactRelation contactRelation);

        ContactRelation GetContactRelation(Int32 id);

        ContactRelation GetContactRelation(ContactContainer contactContainer, IUser userContact);

        ContactRelationCollection GetContacts(ContactContainer contactContainer, ContactType type, Perspective perspective, Int32 page,
                                              Int32 pageSize, ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContacts(ContactContainer contactContainer, ContactType type, Perspective perspective, Int32 page,
                                              Int32 pageSize, out Int32 totalItems, ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContacts(IUser owner, ContactType type, Perspective perspective, Int32 page, Int32 pageSize,
                                              ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContacts(IUser owner, ContactType type, Perspective perspective, Int32 page, Int32 pageSize,
                                              out Int32 totalItems, ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContacts(IUser owner, ContactType type, Perspective perspective, Int32 page, Int32 pageSize,
                                              SiteCollection sites, ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContacts(IUser owner, ContactType type, Perspective perspective, Int32 page, Int32 pageSize,
                                              SiteCollection sites, out Int32 totalItems, ContactRelationSortOrder[] orderBy);

        RatingCollection GetContactsRatedItems(ContactContainer contactContainer, Int32 page, Int32 pageSize);

        RatingCollection GetContactsRatedItems(ContactContainer contactContainer, Int32 page, Int32 pageSize, out Int32 totalItems);

        RatingCollection GetContactsRatedItems(ContactContainer contactContainer, Int32 page, Int32 pageSize, out Int32 totalItems,
                                               Type objectType);

        ContactRelationCollection GetContactsOnline(ContactContainer contactContainer, ContactType contactType, Perspective perspective,
                                                    Int32 page, Int32 pageSize, out Int32 totalItems, ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContactsOnline(IUser owner, ContactType type, Perspective perspective, Int32 page, Int32 pageSize,
                                                    out Int32 totalItems, SiteCollection sites, ContactRelationSortOrder[] orderBy);

        ContactRelationCollection GetContactsOnline(IUser owner, ContactType type, Perspective perspective, Int32 page, Int32 pageSize,
                                                    SiteCollection sites, out Int32 totalItems, ContactRelationSortOrder[] orderBy);

        event EPiServerCommonEventHandler ContactRelationAdded;

        event EPiServerCommonEventHandler ContactRelationUpdated;

        event EPiServerCommonEventHandler ContactRelationRemoved;

        ContactContainerCollection GetQueryResult(ContactContainerQuery query);

        ContactContainerCollection GetQueryResult(ContactContainerQuery query, Int32 page, Int32 pageSize);

        ContactContainerCollection GetQueryResult(ContactContainerQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);

        ContactRelationCollection GetQueryResult(ContactRelationQuery query);

        ContactRelationCollection GetQueryResult(ContactRelationQuery query, Int32 page, Int32 pageSize);

        ContactRelationCollection GetQueryResult(ContactRelationQuery query, Int32 page, Int32 pageSize, out Int32 totalItems);
    }
}